#include "mystring.h"

namespace bit
{
	void test1()
	{
		string s("abcdefg");
		cout << s.c_str() << endl;
		cout << s.capacity() << endl;
		cout << s.size() << endl;

		s.reserve(10);
		cout << s.capacity() << endl;
		cout << endl;
		string s2;
		s2.push_back('a');
		cout << s2.capacity() << endl;
		cout << s2.size() << endl;
		s2.push_back('a');
		s2.push_back('a');
		cout << s2.c_str() << endl;
		s2.push_back('a');
		cout << s2.c_str() << endl;
		cout << s2.capacity() << endl;
		s2.push_back('a');
		s2.push_back('a');
		cout << s2.c_str() << endl;
		cout << s2.capacity() << endl;

	}

	void test2()
	{
		string s;
		s.append("abc");
		cout << s.c_str() << endl;
		cout << s.capacity() << endl;
		cout << s.size() << endl;
		s.append("efg");
		cout << s.c_str() << endl;
		cout << s.capacity() << endl;
		cout << s.size() << endl;
		s.insert(2, "oo");
		cout << s.c_str() << endl;
		cout << s.capacity() << endl;
		cout << s.size() << endl;
		s.erase(2, 3);
		cout << s.c_str() << endl;
		cout << s.capacity() << endl;
		cout << s.size() << endl;
	}
}

int main()
{
	//bit::test1();
	bit::test2();
}